<?php

header('Content-Type:text/html;charset=utf-8');

@$a=$_POST['xczm'];
@$b=$_POST['id'];


$PDO=new PDO('mysql:dbname=diancan;charset=UTF8;','root');
$sel=$PDO->prepare('select * from canzhuo where name=:aa');
$sel->execute(array('aa'=>$a));
$bb=$sel->fetchAll(PDO::FETCH_NAMED);
if (empty($bb)) {
	$xcz=$PDO->prepare('update canzhuo set name=:bb where id=:zxc');
	$xcz->execute(array('zxc'=>$b,'bb'=>$a));
	header('Location:czgl.php');
}else{
	echo "餐桌名重复，请重新输入！";
	header('Refresh:1;url=czgl.php');
}

?>